class Condition:
    def __init__(self, bar='5m', consecutive_bars=10, direction=1, recent_three_bars_compare_ema20= True, three_bars_consecutive = False):
        """
           bar: k线级别，[1m/3m/5m/15m/30m/1H/2H/4H]
           consecutive_bars： 连续k线数
           direction： 1:上涨，0:下跌
        """
        # 如果没有传递 bars 参数，默认为一个包含 '5m' 的列表
        self.bar = bar  # bars 是一个列表
        self.direction = direction # 1.上涨 0.下跌
        self.consecutive_bars = consecutive_bars  # 连续多少个bar满足条件
        self.recent_three_bars_compare_ema20 = recent_three_bars_compare_ema20  # 是否最近比较连续三个bar和ema20的大小，根据direction的值比较
        self.three_bars_consecutive = three_bars_consecutive  # 是否最近比较连续三个bar上涨

    def __str__(self):
        return f"Bars: {self.bar}, consecutiveBars： {self.consecutive_bars},Direction: {self.direction}"
